Telegram Group & Telegram Channel
السلام عليكم
اعتذر على عدم إكمال بقية المواضيع بالأمس وذلك بسبب انقطاع الشبكة 😄
اليوم سنقوم بشرح الموضوع الثاني لنبدأ.
كيف تضيف خاصية جديدة او ميزة الى أداة من الأدوات
طبعاً الميزة او الخاصية الجديدة التي تريد ان تضيفها الى أداة تعتمد على تفكيرك فمثلاً
انا خطرت فكرة اني اعمل ميزة للازرار التي في الفورم ميزة انو عندما يكون مؤشر الماوس فوق الزر تتغير الايقونة وعندما يغادر مؤشر الماوس من الزر تعود الايقونة الى الايقونة السابقة
لنفرض ان معك في الفورم 4 او 5 او حتى 10 ازرار فإنك حتماً ستحتاج لكل زر دالتين دالة للحدث MouseHover ودالة للحدث mouseLeave
كود :
public Form5()
{
InitializeComponent();

}

private void button2_MouseHover(object sender, EventArgs e)
{
button2.Image = Image.FromFile(@"C:\Users\HASSAN_2\Desktop\Icon\eee.png");
}

private void button2_MouseLeave(object sender, EventArgs e)
{
button2.Image = Image.FromFile(@"C:\Users\HASSAN_2\Desktop\Icon\bb.png");
}

هل لاحظت المثال السابق سوف تقوم بتكرار نفس العملية لجميع الازرار
طريقة مملة صحيح اذاً لنبدأ بالطريقة الاحترافية
الأمثلة السابقة فقط لتوضيح الفكرة
كيف تعمل الطريقة الاحترافية
الفكرة هي انك تقوم بعمل كلاس وتقوم بالوراثة من الكلاس Button
ثم تقوم بتعريف متغيرين من نوع Image ولكل متغير خاصية get و set
ثم تقوم بإستنساخ الدوال الوهمية التالية
OnMouseHover
OnMouseLeave
ملاحظة لمن لايعرف ماذا يعني دالة ناسخة override او وهمية virtual يراجع معلوماته في الأساسيات (البرمجة الشيئية)
الكود كامل :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing;
namespace Resize_Form
{
class CustomButton:Button
{
Image normalImage;
Image hoverImage;

public Image NormalImage
{
get
{
return normalImage;
}

set
{
normalImage = value;
Image = normalImage;
}
}

public Image HoverImage
{
get
{
return hoverImage;
}

set
{
hoverImage = value;
}
}
protected override void OnMouseHover(EventArgs e)
{
Image = hoverImage;
base.OnMouseHover(e);
}

protected override void OnMouseLeave(EventArgs e)
{
Image = normalImage;
base.OnMouseLeave(e);
}
}
}



tg-me.com/CsharpWindowsForm/374
Create:
Last Update:

السلام عليكم
اعتذر على عدم إكمال بقية المواضيع بالأمس وذلك بسبب انقطاع الشبكة 😄
اليوم سنقوم بشرح الموضوع الثاني لنبدأ.
كيف تضيف خاصية جديدة او ميزة الى أداة من الأدوات
طبعاً الميزة او الخاصية الجديدة التي تريد ان تضيفها الى أداة تعتمد على تفكيرك فمثلاً
انا خطرت فكرة اني اعمل ميزة للازرار التي في الفورم ميزة انو عندما يكون مؤشر الماوس فوق الزر تتغير الايقونة وعندما يغادر مؤشر الماوس من الزر تعود الايقونة الى الايقونة السابقة
لنفرض ان معك في الفورم 4 او 5 او حتى 10 ازرار فإنك حتماً ستحتاج لكل زر دالتين دالة للحدث MouseHover ودالة للحدث mouseLeave
كود :
public Form5()
{
InitializeComponent();

}

private void button2_MouseHover(object sender, EventArgs e)
{
button2.Image = Image.FromFile(@"C:\Users\HASSAN_2\Desktop\Icon\eee.png");
}

private void button2_MouseLeave(object sender, EventArgs e)
{
button2.Image = Image.FromFile(@"C:\Users\HASSAN_2\Desktop\Icon\bb.png");
}

هل لاحظت المثال السابق سوف تقوم بتكرار نفس العملية لجميع الازرار
طريقة مملة صحيح اذاً لنبدأ بالطريقة الاحترافية
الأمثلة السابقة فقط لتوضيح الفكرة
كيف تعمل الطريقة الاحترافية
الفكرة هي انك تقوم بعمل كلاس وتقوم بالوراثة من الكلاس Button
ثم تقوم بتعريف متغيرين من نوع Image ولكل متغير خاصية get و set
ثم تقوم بإستنساخ الدوال الوهمية التالية
OnMouseHover
OnMouseLeave
ملاحظة لمن لايعرف ماذا يعني دالة ناسخة override او وهمية virtual يراجع معلوماته في الأساسيات (البرمجة الشيئية)
الكود كامل :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing;
namespace Resize_Form
{
class CustomButton:Button
{
Image normalImage;
Image hoverImage;

public Image NormalImage
{
get
{
return normalImage;
}

set
{
normalImage = value;
Image = normalImage;
}
}

public Image HoverImage
{
get
{
return hoverImage;
}

set
{
hoverImage = value;
}
}
protected override void OnMouseHover(EventArgs e)
{
Image = hoverImage;
base.OnMouseHover(e);
}

protected override void OnMouseLeave(EventArgs e)
{
Image = normalImage;
base.OnMouseLeave(e);
}
}
}

BY برمجة تطبيقات الويندوز C# Programming


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/CsharpWindowsForm/374

View MORE
Open in Telegram


برمجة تطبيقات الويندوز C Programming Telegram | DID YOU KNOW?

Date: |

How Does Bitcoin Mining Work?

Bitcoin mining is the process of adding new transactions to the Bitcoin blockchain. It’s a tough job. People who choose to mine Bitcoin use a process called proof of work, deploying computers in a race to solve mathematical puzzles that verify transactions.To entice miners to keep racing to solve the puzzles and support the overall system, the Bitcoin code rewards miners with new Bitcoins. “This is how new coins are created” and new transactions are added to the blockchain, says Okoro.

Telegram hopes to raise $1bn with a convertible bond private placement

The super secure UAE-based Telegram messenger service, developed by Russian-born software icon Pavel Durov, is looking to raise $1bn through a bond placement to a limited number of investors from Russia, Europe, Asia and the Middle East, the Kommersant daily reported citing unnamed sources on February 18, 2021.The issue reportedly comprises exchange bonds that could be converted into equity in the messaging service that is currently 100% owned by Durov and his brother Nikolai.Kommersant reports that the price of the conversion would be at a 10% discount to a potential IPO should it happen within five years.The minimum bond placement is said to be set at $50mn, but could be lowered to $10mn. Five-year bonds could carry an annual coupon of 7-8%.

برمجة تطبيقات الويندوز C Programming from de


Telegram برمجة تطبيقات الويندوز C# Programming
FROM USA